cmake_minimum_required(VERSION 2.6)
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt REQUIRED)

FILE( GLOB PO_FILES ${CMAKE_SOURCE_DIR}/po/*.po )
   add_custom_target(translations ALL)
   foreach(_poFile ${PO_FILES})
        get_filename_component(_lang ${_poFile} NAME_WE)
        set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
        add_custom_command(TARGET translations
            COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
            DEPENDS ${_poFile})
        install(FILES ${_gmoFile} DESTINATION locale/${_lang}/LC_MESSAGES/ RENAME ${PROJECT_NAME}.mo)
    endforeach(_poFile ${PO_FILES})


